package cn.luckdou.WeChat.config;


public class WxMpConfig {
    private static String appid="wx59b8f21d58757431";//测试平台

    private static String appsecret="24041844507ddea8e13be36838b4b76d";//测试平台

    private static String token="haveZone";

    private static String access_token_url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";

    private static String user_info_url="https://api.weixin.qq.com/cgi-bin/user/info";

    private static String code_url="https://api.weixin.qq.com/sns/oauth2/access_token";

    private static String jsapi_ticket="https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi";

    public static String getAppid() {
        return appid;
    }

    public static String getAppsecret() {
        return appsecret;
    }

    public static String getToken() {
        return token;
    }

    public static String getAccess_token_url() {
        return access_token_url+"&appid="+appid+"&secret="+appsecret;
    }

    /**
     * 获取用户信息
     * @param access_token
     * @param openid
     * @return
     */
    public static String getUser_info_url(String access_token,String openid) {
        return user_info_url+"?access_token="+access_token+"&openid="+openid+"&lang=zh_CN";
    }

    /**
     *
     * @param code
     * @return
     */
    public static String getCode_url(String code) {

        return code_url+"?appid="+appid+"&secret="+appsecret+"&code="+code+"&grant_type=authorization_code";
    }

    public static String getJsapi_ticket(String access_token) {
        String jsapiTicket = jsapi_ticket.replaceAll("ACCESS_TOKEN", access_token);
        return jsapiTicket;
    }
}
